/**
 * @author ztl
 * @date 2017年1月14日下午5:54:38
 */
package com.zhihuishu.micro.course.openapi.app.impl.teacher;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import com.zhihuishu.micro.course.openapi.app.teacher.CourseAnalysisDataOpenService;
import com.zhihuishu.micro.course.service.CourseAnalysisDataService;
import com.zhihuishu.remote.RemoteResult;

/**
 * @description 课程数据分析Service 
 * @author ztl
 * 2017年1月14日
 */
@Service("courseAnalysisDataOpenServiceForApp")
public class CourseAnalysisDataOpenServiceImpl implements CourseAnalysisDataOpenService{

	@Resource
    private CourseAnalysisDataService courseAnalysisDataService;
	
	protected Logger logger=LoggerFactory.getLogger(getClass());
	
	@Override
	public RemoteResult<List<Map<String, Object>>> getCourseListByUserId(Long userId) {
		RemoteResult<List<Map<String, Object>>> result = new RemoteResult<List<Map<String,Object>>>();
		try {
			Assert.notNull(userId, "用户id不能为空");
			List<Map<String, Object>> mapResult = courseAnalysisDataService.getCourseListByUserId(userId);
			result.setResult(mapResult);
		} catch (Exception e) {
			result.setExceptionStack(e);
			result.setSuccess(false);
            logger.error("查询课程列表发生错误,参数信息为{}",userId,e);
		}
		return result;
	}

}
